home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
292_04
/
tz80.asm
< prev
next >
Wrap
Assembly Source File
|
1990-07-16
|
27KB
|
1,014 lines
.title Test of Z80 / HD64180 assembler
offset = 0x55 ;arbitrary constants
n = 0x20
nn = 0x0584
; notes:
; Leading 'a' operand is optional.
; If offset is ommitted 0 is assumed.
;***********************************************************
;add with carry to 'a'
adc a,(hl) ; 8E
adc a,offset(ix) ; DD 8E 55
adc a,offset(iy) ; FD 8E 55
adc a,a ; 8F
adc a,b ; 88
adc a,c ; 89
adc a,d ; 8A
adc a,e ; 8B
adc a,h ; 8C
adc a,l ; 8D
adc a,#n ; CE 20
;***********************************************************
adc (hl) ; 8E
adc offset(ix) ; DD 8E 55
adc offset(iy) ; FD 8E 55
adc a ; 8F
adc b ; 88
adc c ; 89
adc d ; 8A
adc e ; 8B
adc h ; 8C
adc l ; 8D
adc #n ; CE 20
;***********************************************************
;add with carry register pair to 'hl'
adc hl,bc ; ED 4A
adc hl,de ; ED 5A
adc hl,hl ; ED 6A
adc hl,sp ; ED 7A
;***********************************************************
;add operand to 'a'
add a,(hl) ; 86
add a,offset(ix) ; DD 86 55
add a,offset(iy) ; FD 86 55
add a,a ; 87
add a,b ; 80
add a,c ; 81
add a,d ; 82
add a,e ; 83
add a,h ; 84
add a,l ; 85
add a,#n ; C6 20
;***********************************************************
;add register pair to 'hl'
add hl,bc ; 09
add hl,de ; 19
add hl,hl ; 29
add hl,sp ; 39
;***********************************************************
;add register pair to 'ix'
add ix,bc ; DD 09
add ix,de ; DD 19
add ix,ix ; DD 29
add ix,sp ; DD 39
;***********************************************************
;add register pair to 'iy'
add iy,bc ; FD 09
add iy,de ; FD 19
add iy,iy ; FD 29
add iy,sp ; FD 39
;***********************************************************
;logical 'and' operand with 'a'
and a,(hl) ; A6
and a,offset(ix) ; DD A6 55
and a,offset(iy) ; FD A6 55
and a,a ; A7
and a,b ; A0
and a,c ; A1
and a,d ; A2
and a,e ; A3
and a,h ; A4
and a,l ; A5
and a,#n ; E6 20
;***********************************************************
;test bit of location or register
bit 0,(hl) ; CB 46
bit 0,offset(ix) ; DD CB 55 46
bit 0,offset(iy) ; FD CB 55 46
bit 0,a ; CB 47
bit 0,b ; CB 40
bit 0,c ; CB 41
bit 0,d ; CB 42
bit 0,e ; CB 43
bit 0,h ; CB 44
bit 0,l ; CB 45
bit 1,(hl) ; CB 4E
bit 1,offset(ix) ; DD CB 55 4E
bit 1,offset(iy) ; FD CB 55 4E
bit 1,a ; CB 4F
bit 1,b ; CB 48
bit 1,c ; CB 49
bit 1,d ; CB 4A
bit 1,e ; CB 4B
bit 1,h ; CB 4C
bit 1,l ; CB 4D
bit 2,(hl) ; CB 56
bit 2,offset(ix) ; DD CB 55 56
bit 2,offset(iy) ; FD CB 55 56
bit 2,a ; CB 57
bit 2,b ; CB 50
bit 2,c ; CB 51
bit 2,d ; CB 52
bit 2,e ; CB 53
bit 2,h ; CB 54
bit 2,l ; CB 55
bit 3,(hl) ; CB 5E
bit 3,offset(ix) ; DD CB 55 5E
bit 3,offset(iy) ; FD CB 55 5E
bit 3,a ; CB 5F
bit 3,b ; CB 58
bit 3,c ; CB 59
bit 3,d ; CB 5A
bit 3,e ; CB 5B
bit 3,h ; CB 5C
bit 3,l ; CB 5D
bit 4,(hl) ; CB 66
bit 4,offset(ix) ; DD CB 55 66
bit 4,offset(iy) ; FD CB 55 66
bit 4,a ; CB 67
bit 4,b ; CB 60
bit 4,c ; CB 61
bit 4,d ; CB 62
bit 4,e ; CB 63
bit 4,h ; CB 64
bit 4,l ; CB 65
bit 5,(hl) ; CB 6E
bit 5,offset(ix) ; DD CB 55 6E
bit 5,offset(iy) ; FD CB 55 6E
bit 5,a ; CB 6F
bit 5,b ; CB 68
bit 5,c ; CB 69
bit 5,d ; CB 6A
bit 5,e ; CB 6B
bit 5,h ; CB 6C
bit 5,l ; CB 6D
bit 6,(hl) ; CB 76
bit 6,offset(ix) ; DD CB 55 76
bit 6,offset(iy) ; FD CB 55 76
bit 6,a ; CB 77
bit 6,b ; CB 70
bit 6,c ; CB 71
bit 6,d ; CB 72
bit 6,e ; CB 73
bit 6,h ; CB 74
bit 6,l ; CB 75
bit 7,(hl) ; CB 7E
bit 7,offset(ix) ; DD CB 55 7E
bit 7,offset(iy) ; FD CB 55 7E
bit 7,a ; CB 7F
bit 7,b ; CB 78
bit 7,c ; CB 79
bit 7,d ; CB 7A
bit 7,e ; CB 7B
bit 7,h ; CB 7C
bit 7,l ; CB 7D
;***********************************************************
;call subroutine at nn if condition is true
call C,nn ; DC 84 05
call M,nn ; FC 84 05
call NC,nn ; D4 84 05
call NZ,nn ; C4 84 05
call P,nn ; F4 84 05
call PE,nn ; EC 84 05
call PO,nn ; E4 84 05
call Z,nn ; CC 84 05
;***********************************************************
;unconditional call to subroutine at nn
call nn ; CD 84 05
;***********************************************************
;complement carry flag
ccf ; 3F
;***********************************************************
;compare operand with 'a'
cp a,(hl) ; BE
cp a,offset(ix) ; DD BE 55
cp a,offset(iy) ; FD BE 55
cp a,a ; BF
cp a,b ; B8
cp a,c ; B9
cp a,d ; BA
cp a,e ; BB
cp a,h ; BC
cp a,l ; BD
cp a,#n ; FE 20
;***********************************************************
;compare location (hl) and 'a'
;decrement 'hl' and 'bc'
cpd ; ED A9
;***********************************************************
;compare location (hl) and 'a'
;decrement 'hl' and 'bc'
;repeat until 'bc' = 0
cpdr ; ED B9
;***********************************************************
;compare location (hl) and 'a'
;increment 'hl' and decrement 'bc'
cpi ; ED A1
;***********************************************************
;compare location (hl) and 'a'
;increment 'hl' and decrement 'bc'
;repeat until 'bc' = 0
cpir ; ED B1
;***********************************************************
;1's complement of 'a'
cpl ; 2F
;***********************************************************
;decimal adjust 'a'
daa ; 27
;***********************************************************
;decrement operand
dec (hl) ; 35
dec offset(ix) ; DD 35 55
dec offset(iy) ; FD 35 55
dec a ; 3D
dec b ; 05
dec bc ; 0B
dec c ; 0D
dec d ; 15
dec de ; 1B
dec e ; 1D
dec h ; 25
dec hl ; 2B
dec ix ; DD 2B
dec iy ; FD 2B
dec l ; 2D
dec sp ; 3B
;***********************************************************
;disable interrupts
di ; F3
;***********************************************************
;decrement b and jump relative if b # 0
djnz .+0x12 ; 10 10
;***********************************************************
;enable interrupts
ei ; FB
;***********************************************************
;exchange location and (sp)
ex (sp),hl ; E3
ex (sp),ix ; DD E3
ex (sp),iy ; FD E3
;***********************************************************
;exchange af and af'
ex af,af' ; 08
;***********************************************************
;exchange de and hl
ex de,hl ; EB
;***********************************************************
;exchange:
; bc <-> bc'
; de <-> de'
; hl <-> hl'
exx ; D9
;***********************************************************
;halt (wait for interrupt or reset)
halt ; 76
;***********************************************************
;set interrupt mode
im 0 ; ED 46
im 1 ; ED 56
im 2 ; ED 5E
;***********************************************************
;load 'a' with input from device n
in a,(n) ; DB 20
;***********************************************************
;load register with input from (c)
in a,(c) ; ED 78
in b,(c) ; ED 40
in c,(c) ; ED 48
in d,(c) ; ED 50
in e,(c) ; ED 58
in h,(c) ; ED 60
in l,(c) ; ED 68
;***********************************************************
;increment operand
inc (hl) ; 34
inc offset(ix) ; DD 34 55
inc offset(iy) ; FD 34 55
inc a ; 3C
inc b ; 04
inc bc ; 03
inc c ; 0C
inc d ; 14
inc de ; 13
inc e ; 1C
inc h ; 24
inc hl ; 23
inc ix ; DD 23
inc iy ; FD 23
inc l ; 2C
inc sp ; 33
;***********************************************************
;load location (hl) with input
;from port (c)
;decrement 'hl' and 'b'
ind ; ED AA
;***********************************************************
;load location (hl) with input
;from port (c)
;